<div id="calendar">
  <table id="calendarTable" lay-filter="calendarTable"></table>
</div>

<script>
  layui.use(["layer", "form", "table", "admin", "laydate", "upload", "laytpl"], async function () {
    const $ = layui.jquery;
    const layer = layui.layer;
    const table = layui.table;
    const nowMonth = new Date().getMonth() + 1;
    const nowYear = new Date().getFullYear();
    let nowMonthDays = new Date(nowYear, nowMonth, 0).getDate();
    // 快速生成长度为33的数组
    const nowMonthDaysArray = Array.from({ length: 33 }, (item, index) => {
      return {
        field: `day${index + 1}`,
        title: index + 1
      };
    });

    table.render({
      elem: "#calendarTable",
      cols: [nowMonthDaysArray],
      data: [],
      where: { id: 1 }
    });
  });
</script>
